home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 2.iso / dist / fw_libglade.idb / usr / freeware / include / glade / glade-xml.h.z / glade-xml.h
C/C++ Source or Header  |  2001-04-12  |  5KB  |  137 lines

  1. /* -*- Mode: C; c-basic-offset: 8 -*-
  2.  * libglade - a library for building interfaces from XML files at runtime
  3.  * Copyright (C) 1998-2001  James Henstridge <james@daa.com.au>
  4.  *
  5.  * glade-xml.h: public interface of libglade library
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Library General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2 of the License, or (at your option) any later version.
  11.  *
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Library General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU Library General Public
  18.  * License along with this library; if not, write to the 
  19.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20.  * Boston, MA  02111-1307, USA.
  21.  */
  22. #ifndef GLADE_XML_H
  23. #define GLADE_XML_H
  24.  
  25. #include <glib.h>
  26. #include <gtk/gtkdata.h>
  27. #include <gtk/gtkwidget.h>
  28. #include <gtk/gtktooltips.h>
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif /* __cplusplus */
  33.     
  34. #define GLADE_XML(obj) GTK_CHECK_CAST((obj), glade_xml_get_type(), GladeXML)
  35. #define GLADE_XML_CLASS(klass) GTK_CHECK_CLASS_CAST((klass), glade_xml_get_type(), GladeXMLClass)
  36. #define GLADE_IS_XML(obj) GTK_CHECK_TYPE((obj), glade_xml_get_type())
  37.  
  38. typedef struct _GladeXML GladeXML;
  39. typedef struct _GladeXMLClass GladeXMLClass;
  40. typedef struct _GladeXMLPrivate GladeXMLPrivate;
  41.  
  42. struct _GladeXML {
  43.   /* <public> */
  44.   GtkData parent;
  45.  
  46.   char *filename;
  47.   char *txtdomain;
  48.  
  49.   /* <private> */
  50.   GladeXMLPrivate *priv;
  51. };
  52.  
  53. struct _GladeXMLClass {
  54.   GtkDataClass parent_class;
  55. };
  56.  
  57. GtkType glade_xml_get_type    (void);
  58. GladeXML *glade_xml_new       (const char *fname, const char *root);
  59. GladeXML *glade_xml_new_with_domain (const char *fname, const char *root,
  60.                      const char *domain);
  61. GladeXML *glade_xml_new_from_memory (char *buffer, int size, const char *root,
  62.                      const char *domain);
  63. gboolean glade_xml_construct  (GladeXML *self, const char *fname,
  64.                    const char *root, const char *domain);
  65.  
  66. void glade_xml_signal_connect (GladeXML *self, const char *handlername,
  67.                    GtkSignalFunc func);
  68. void glade_xml_signal_connect_data (GladeXML *self, const char *handlername,
  69.                     GtkSignalFunc func, gpointer user_data);
  70. /*
  71.  * use gmodule to connect signals automatically.  Basically a symbol with
  72.  * the name of the signal handler is searched for, and that is connected to
  73.  * the associated symbols.  So setting gtk_main_quit as a signal handler
  74.  * for the destroy signal of a window will do what you expect.
  75.  */
  76. void       glade_xml_signal_autoconnect      (GladeXML *self);
  77.  
  78. /* if the gtk_signal_connect_object behaviour is required, connect_object
  79.  * will point to the object, otherwise it will be NULL.
  80.  */
  81. typedef void (*GladeXMLConnectFunc)          (const gchar *handler_name,
  82.                           GtkObject *object,
  83.                           const gchar *signal_name,
  84.                           const gchar *signal_data,
  85.                           GtkObject *connect_object,
  86.                           gboolean after,
  87.                           gpointer user_data);
  88.  
  89. /*
  90.  * These two are to make it easier to use libglade with an interpreted
  91.  * language binding.
  92.  */
  93. void       glade_xml_signal_connect_full     (GladeXML *self,
  94.                           const gchar *handler_name,
  95.                           GladeXMLConnectFunc func,
  96.                           gpointer user_data);
  97.  
  98. void       glade_xml_signal_autoconnect_full (GladeXML *self,
  99.                           GladeXMLConnectFunc func,
  100.                           gpointer user_data);
  101.  
  102.  
  103. GtkWidget *glade_xml_get_widget              (GladeXML *self,
  104.                           const char *name);
  105. GList     *glade_xml_get_widget_prefix       (GladeXML *self,
  106.                           const char *name);
  107. GtkWidget *glade_xml_get_widget_by_long_name (GladeXML *self,
  108.                           const char *longname);
  109.  
  110. gchar     *glade_xml_relative_file           (GladeXML *self,
  111.                           const gchar *filename);
  112.  
  113. /* don't free the results of these two ... */
  114. const char *glade_get_widget_name      (GtkWidget *widget);
  115. const char *glade_get_widget_long_name (GtkWidget *widget);
  116.  
  117. GladeXML   *glade_get_widget_tree      (GtkWidget *widget);
  118.  
  119. /* interface for changing the custom widget handling */
  120. typedef GtkWidget *(* GladeXMLCustomWidgetHandler) (GladeXML *xml,
  121.                             gchar *func_name,
  122.                             gchar *name,
  123.                             gchar *string1,
  124.                             gchar *string2,
  125.                             gint int1,
  126.                             gint int2,
  127.                             gpointer user_data);
  128.  
  129. void glade_set_custom_handler(GladeXMLCustomWidgetHandler handler,
  130.                   gpointer user_data);
  131.  
  132. #ifdef __cplusplus
  133. }
  134. #endif /* __cplusplus */
  135.     
  136. #endif
  137.